<?php 
global $app_request, $db;
$app_request	=	array_merge($_SERVER, $_REQUEST, $_GET, $_POST,$_FILES);
// Pre-Load configuration
require_once( PATH_LIBRARIES.DS.'app'.DS.'base'.DS.'object.php' );

require_once( PATH_CONFIGURATION	.DS.'configuration.php' );
// System configuration
$CONFIG = new Config();
require_once( PATH_SITE.DS.'includes'.DS.'environment'.DS.'request.php' );
require_once( PATH_SITE.DS.'includes'.DS.'environment'.DS.'uri.php' );
require_once (PATH_SITE.DS.'libraries'.DS.'app'.DS.'router.php');
if ($CONFIG->sef == 1)
{
	$uri	=	APPURI::root().'index.php?'.$_SERVER['QUERY_STRING'];
	APPRouter::parse($uri);
}
unset( $CONFIG );

require_once (PATH_SITE.DS.'libraries'.DS.'app'.DS.'factory.php');

$app	=	 Request::getCmd('app','feed');

$db	=	Factory::getDBO();

define( 'PATH_APP_SITE', 	PATH_SITE.DS.'apps'.DS.'app_'.$app );
define( 'PATH_APP_ADMIN', 	PATH_ADMIN.DS.'apps'.DS.'app_'.$app );
define( 'PATH_APP', 	PATH_APP_SITE );

if (file_exists(PATH_APP_SITE.DS.$app.'.php'))
	require_once (PATH_APP_SITE.DS.$app.'.php');
else {
	appexit('This app is not existing');
}


//$query	=	'select * from `#__categories`';
//$db->setQuery();
//$obj	=	$db->loadObjectList();
?>